// class MemoryRequest
//
// A memory request from one part of the system to another.
//

#ifndef __MEMORYREQUEST_H__
#define __MEMORYREQUEST_H__

#include "base/Entity.h"
#include "base/Request.h"
#include "base/simtypes.h"

class Processor;

/// A request associated with an address (and thus memory)
class MemoryRequest : public Request {
  public:
    NEW_DELETE_OPERATORS_H(MemoryRequest,Request);
    MemoryRequest(VA addr, Processor* P, Entity* source, Entity* dest, uint size);
    virtual ~MemoryRequest();
    
    VA getAddress() const;

    /// Get processor, if any associated with this request
    Processor* getProcessor() const;

    /// Recursively delete the initiating request and it's initiators. 
    void recursiveDelete ();

    /// Get the entity that initially caused this Request
    Entity* getInitiatingRequester() const;

    /** The request that started this stream of requests
        
        For example, a Request that misses in the cache would be the
        initiatingRequest in the LoadRequest sent from the cache to
        refill the cache line.
        
    */
    MemoryRequest* initiatingRequest;

  private:
    VA address;
    Processor* processor;
};

#endif // __MEMORYREQUEST_H__
